package 寒假刷题;

import java.util.ArrayList;
import java.util.List;

public class 自除数 {
    public List<Integer> selfDividingNumbers(int left, int right) {
        List<Integer> list = new ArrayList<>();
        for (int i = left; i <=right; i++) {
            if (isChu(i))
                list.add(i);
        }
        return list;
    }

    private boolean isChu(int num) {
        int temp = num;
        while (num>0){
            int i = num % 10;
            if (i==0 || temp%i!=0)
                return false;
            num/=10;
        }
        return true;
    }
}
